package com.boc.langxiang.ui.adapter.adm;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.view.ViewGroup;

import java.util.ArrayList;
import java.util.List;

/**
 * CreateTime: 2016-06-28下午5:03
 * Author: wjkjinke00@126.com
 * Description:
 */
public class ArtistIndexPagerAdapter extends FragmentPagerAdapter {
    private  List<Fragment> mFragments = new ArrayList<>();
    private  List<String> mFragmentTitles = new ArrayList<>();


    public ArtistIndexPagerAdapter(FragmentManager fm) {
        super(fm);
    }


    public void addFragment(Fragment fragment, String title) {
        mFragments.add(fragment);
        mFragmentTitles.add(title);
    }

    @Override
    public Fragment getItem(int position) {
        return mFragments.get(position);
    }

    @Override
    public int getCount() {
        return mFragments.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return mFragmentTitles.get(position);
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        //防止销毁item
    }
}
